package com.kly.cashmall.widget.refresh;

import android.app.Application;
import android.content.Context;
import androidx.annotation.NonNull;

import com.scwang.smart.refresh.layout.SmartRefreshLayout;
import com.scwang.smart.refresh.layout.api.RefreshFooter;
import com.scwang.smart.refresh.layout.api.RefreshHeader;
import com.scwang.smart.refresh.layout.api.RefreshLayout;
import com.scwang.smart.refresh.layout.listener.DefaultRefreshFooterCreator;
import com.scwang.smart.refresh.layout.listener.DefaultRefreshHeaderCreator;

/**
 * @author chenwei
 * @date 2018/1/22
 */
public class RefreshInit {

  public static void init(Application application) {
    SmartRefreshLayout.setDefaultRefreshHeaderCreator(new DefaultRefreshHeaderCreator() {
      @NonNull
      @Override
      public RefreshHeader createRefreshHeader(@NonNull Context context,
                                               @NonNull RefreshLayout layout) {
        return new SimpleRefreshHeader(context);
      }
    });
    SmartRefreshLayout.setDefaultRefreshFooterCreator(new DefaultRefreshFooterCreator() {
      @NonNull
      @Override
      public RefreshFooter createRefreshFooter(@NonNull Context context,
                                               @NonNull RefreshLayout layout) {
        return new SimpleRefreshFooter(context);
      }
    });
  }
}
